/*
 *
 *  This file is part of Cfu
 *
 *  Cfu is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *  
 *  Cfu is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with Cfu. If not, see <http://www.gnu.org/licenses/>.
 *
 *  parametersdialog.cc - william le ferrand (william@corefarm.com) 29/04/2010 15:30
 *
 */


// STL
#include <stdio.h>
#include <iostream>

// QT
#include <QMenu>
#include <QMessageBox>
#include <QDebug>
#include <QApplication>

// CFU
#include <parametersdialog.hpp>
#include <configuration.hpp>

parametersdialog_t::parametersdialog_t(QWidget *parent, configuration_t *conf) :
  QDialog(parent),
  _ui(new Ui::ParametersDialog), 
  _conf (conf) 
{
  _ui->setupUi(this); 
  _ui->loginLineEdit->setText(conf->getLogin ());
  _ui->passwordLineEdit->setText(conf->getPassword());
}; 

parametersdialog_t::~parametersdialog_t()
{
  delete _ui; 
}


void parametersdialog_t::_onAccepted()
{
  _conf->setLogin(_ui->loginLineEdit->text());
  _conf->setPassword(_ui->passwordLineEdit->text());
  _conf->saveConfigurationToFile(); 
  accept();
}

void parametersdialog_t::_onRejected()
{
    reject();
}

